package com.zxyankh.common.rpc;

import com.zxyankh.common.rpc.client.NettyClient;

import java.util.Random;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * @author ankh
 * @since 22.11.2017
 */
public class NettyClientTest {
    public static void main(String[] args) throws Exception {
        ExecutorService executorService = Executors.newFixedThreadPool(5);
        Random random = new Random();
        for (int i = 0; i < 100; i++) {
            executorService.execute(() -> NettyClient.call("127.0.0.1", 8080, "123"));
            Thread.sleep(100 * random.nextInt(5));
        }
        executorService.shutdown();
        while (!executorService.isTerminated()) {

        }
        System.out.println("Finish");
    }
}
